package com.wzu;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

public class AddBookServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        
        // 获取表单参数
        String title = request.getParameter("title");
        String author = request.getParameter("author");
        // ... 其他参数获取
        
        // 数据库插入操作
        try {
            // 示例：使用PreparedStatement执行INSERT操作
            // 连接db.properties中的数据库
            
            response.sendRedirect("bookList.jsp");
        } catch (Exception e) {
            response.sendError(500, "图书添加失败");
        }
    }
}